<template>
  <div class="welcome-section">
    <div class="overlay"></div>
    <div class="welcome-content">
      <h1 class="welcome-message">{{ message }}</h1>
      <p class="welcome-description">{{ description }}</p>
      <p class="welcome-description" v-if="$store.getters.user.type==0">当前用户：超级管理员</p>
      <button v-if="$store.getters.user.type!=0" class="welcome-button" @click="redirectTo()">开始体验</button>
    </div>
    <img src="../../assets/ht-4.jpg" class="welcome-image" alt="Welcome Image">
  </div>
</template>

<script>
export default {
  props: {
    message: {
      type: String,
      default: "欢迎您"
    },
    description: {
      type: String,
      default: "这是一个健康管理系统，帮助您更好地管理自己的健康。"
    },
    redirectUrl: {
      type: String,
      required: false
    }
  },
  methods: {
    redirectTo() {
      if (this.$store.getters.user.type==2){
        this.$router.push({name: 'Exam'})
      }else {
        this.$router.push({name: 'ExamAdmin'})
      }
    }
  }
};
</script>

<style scoped>
.welcome-section {
  position: relative;
  width: 100%;
  height: calc(100vh - 60px);
  display: flex;
  justify-content: center;
  align-items: center;
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1;
}

.welcome-content {
  position: relative;
  z-index: 2;
  color: #fff;
  text-align: center;
}

.welcome-message {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.welcome-description {
  font-size: 1.5rem;
  margin-bottom: 2rem;
}

.welcome-button {
  padding: 1rem 2rem;
  background-color: #fff;
  color: #333;
  border: none;
  border-radius: 2rem;
  font-size: 1.2rem;
  cursor: pointer;
}

.welcome-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
</style>
